package com.example.mq.controller;

import com.example.mq.producer.MyProducer;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * @auth 贾枣阳
 * @date 2021/2/2 17:08
 */
@Controller
@RequestMapping("test")
public class MqController {

    @Resource
    private MyProducer msgProducer;

    @RequestMapping("rabbit/{str}")
    @ResponseBody
    public String basicExport(@PathVariable String str) throws IOException {

        msgProducer.send(str);
        return str;
    }

}
